import 'package:demo/mixin/view_state_type_change_mixin.dart';
import 'package:flutter/foundation.dart';

class BaseViewModel with ChangeNotifier, ViewStateTypeChangeMixin {
  /// 页面状态
  ViewState _viewState = ViewState.Idle;

  ViewState get viewState => _viewState;

  set viewState(ViewState state) {
    if (_viewState != state) {
      _viewState = state;
      notifyListeners();
    }
  }

  /// 本页多dialog排队显示
  List<bool> _activityDialog = [];

  List<bool> get activityDialog => _activityDialog;

  set activityDialog(List<bool> state) {
    _activityDialog = state;
    notifyListeners();
  }

  /// 隐藏某个或则显示某个dialog
  void setActivityDialogState(int index, bool state) {
    activityDialog = List.of(_activityDialog)..[index] = state;
  }
}
